package uk.ac.ebi.dod.beans;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.List;

/**
 * @author Florian Reisinger
 * @since 0.1
 */
public class Filter {

    private static final Log log = LogFactory.getLog(Filter.class);

    private String name;
    private String label;
    private String parameter;

    private boolean enableParamInput;

    // for IN-TABLE-ROW-DELETION
    List<Filter> parent;

    ///// ///// ///// ///// /////
    // CONSTRUCTOR

    public Filter() {
        log.debug("Creating new Filter.");
    }              

    ///// ///// ///// ///// /////
    // METHODS

    public String action() {
        if (parent != null) {
            parent.remove(this);
            log.debug("Removed filter [" + name + "|" + parameter + "] from list: " + parent);
        }
        return null;
    }

    ///// ///// ///// ///// /////
    // GETTER & SETTER

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getParameter() {
        return parameter;
    }

    public void setParameter(String parameter) {
        this.parameter = parameter;
    }

    public List<Filter> getParent() {
        return parent;
    }

    public void setParent(List<Filter> parent) {
        this.parent = parent;
    }

    public boolean getEnableParamInput() {
        return enableParamInput;
    }

    public void setEnableParamInput(boolean enableParamInput) {
        this.enableParamInput = enableParamInput;
    }
}
